<?php
class Order_model extends Model {
	/**
	 * 产生不重复的oid
	 */
	public function oid($uid) {
		$dOrder = new Order_data();
		return $dOrder->oid($uid);
	}
	/**
	 * 添加订单
	 * @param unknown_type $params
	 */
	public function add($params) {
		$dOrder = new Order_data();
		return $dOrder->add($params);
	}
	/**
	 * 分页获取景点
	 * @param unknown_type $page
	 * @param unknown_type $size
	 * @param unknown_type $params
	 */
	public function page($page = 1, $size = 20, $params = array()) {
		$dOrder = new Order_data();
		$num = $dOrder->count($params);
		if($num === false) return false;
		if($num == 0) return array('num' => $num, 'data' => array(), 'page' => $page, 'size' => $size);
		
		$data = $dOrder->page($page, $size, $params, $orderby = '`id` DESC');
		if($data === false) return false;
				
		return array('num' => $num, 'data' => $data, 'page' => $page, 'size' => $size);
	}
}